Crate dominion

source ·
Expand description

Dominion

A crate to implement DNS Servers and clients.

Server

use dominion::{Server, ServerService, DnsPacket};
use std::net::SocketAddr;

struct Echo;

impl ServerService for Echo {
    fn run<'a>(&self, _client: SocketAddr, question: &'a DnsPacket<'a>) -> Option<DnsPacket<'a>> { Some(question.clone()) }
}

Server::default()
        .bind("127.0.0.1:5353".parse().unwrap())
        .unwrap()
        .serve(Echo);

Client

Modules

The body of the DNS packet (Questions and Resource Records)
The header of the DNS packet
Domain name structure and funtions

Structs

A DNS header.
Represents a complete DNS packet.
DNS Flags
A domain name represented as an inverted list of labels.
A query for a ResourceRecord of the specified QType and Class.
The ResourceRecord preamble. Common data to all resource record types.
A description of a resource that can be used as an answer to a question or to provide additional information in the authority or additional fields of a DNS packet.
A DNS server

Enums

DNSSEC flag to indicate if the data has been cryptographically authenticated
Flag to indicate if the answer is authoritative
DNSSEC flag to indicate if the client has enabled checking of the data.
An enumeration of the different available DNS Classes.
An error was encountered when trying to work with a domain name
Standard query (0), Inverse query (1), Server status query (2), Notify (4), Update (5), DSO (6)
An error was encountered when trying to parse a byte buffer into a DNS packet
The type of Question.
Query (0) or Response (1) packet.
The ResourceRecord data associated with the corresponding Name.
Flag to indicate if recursion is available by the server.
Flag to indicate if recursion is desired by the client.
Response code
Flag to indicate if the packet has been truncated.
The type of ResourceRecord.
Reserved, should be 0.

Traits

A DNS service, it recieves a DnsPacket as a question and it has to return anotherone as a response.